<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>tango.math.IEEE</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "tango.math.IEEE";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/tango.math.IEEE.html" class="symbol">tango.math.IEEE</a></h1>
  
<div class="summary">Low-level Mathematical Functions which take advantage of the IEEE754 ABI.</div>
<p class="sec_header">License:</p>BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a>, Digital Mars.
<p class="sec_header">Authors:</p>Don Clugston, Walter Bright, Sean Kelly
<dl>
<dt class="decl">struct <a class="symbol _struct" name="IeeeFlags" href="./htmlsrc/tango.math.IEEE.html#L239" kind="struct" beg="239" end="344">IeeeFlags</a><span class="tparams">(T)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L239">#</a></dt>
<dd class="ddef">
<div class="summary">IEEE exception status flags</div>
These flags indicate that an exceptional floating-point condition has occured.
 They indicate that a NaN or an infinity has been generated, that a result
 is inexact, or that a signalling NaN has been encountered.
 The return values of the properties should be treated as booleans, although
 each is returned as an int, for speed.
<p class="sec_header">Example:</p><pre class="d_code">
<span class="k">real</span> <span class="i">a</span>=<span class="n">3.5</span>;
<span class="lc">// Set all the flags to zero</span>
<span class="i">resetIeeeFlags</span>();
<span class="k">assert</span>(!<span class="i">ieeeFlags</span>.<span class="i">divByZero</span>);
<span class="lc">// Perform a division by zero.</span>
<span class="i">a</span>/=<span class="n">0.0L</span>;
<span class="k">assert</span>(<span class="i">a</span>==<span class="k">real</span>.<span class="i">infinity</span>);
<span class="k">assert</span>(<span class="i">ieeeFlags</span>.<span class="i">divByZero</span>);
<span class="lc">// Create a NaN</span>
<span class="i">a</span>*=<span class="n">0.0L</span>;
<span class="k">assert</span>(<span class="i">ieeeFlags</span>.<span class="i">invalid</span>);
<span class="k">assert</span>(<span class="i">isNaN</span>(<span class="i">a</span>));

<span class="lc">// Check that calling func() has no effect on the</span>
<span class="lc">// status flags.</span>
<span class="i">IeeeFlags</span> <span class="i">f</span> = <span class="i">ieeeFlags</span>;
<span class="i">func</span>();
<span class="k">assert</span>(<span class="i">ieeeFlags</span> == <span class="i">f</span>);

</pre>
<dl>
<dt class="decl">int <a class="symbol _function" name="IeeeFlags.inexact" href="./htmlsrc/tango.math.IEEE.html#L335" kind="function" beg="335" end="335">inexact</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags.inexact" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L335">#</a></dt>
<dd class="ddef">
<div class="summary">The result cannot be represented exactly, so rounding occured.
 (example: x = sin(0.1); }</div></dd>
<dt class="decl">int <a class="symbol _function" name="IeeeFlags.underflow" href="./htmlsrc/tango.math.IEEE.html#L337" kind="function" beg="337" end="337">underflow</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags.underflow" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L337">#</a></dt>
<dd class="ddef">
<div class="summary">A zero was generated by underflow (example: x = real.min*real.epsilon/2;)</div></dd>
<dt class="decl">int <a class="symbol _function" name="IeeeFlags.overflow" href="./htmlsrc/tango.math.IEEE.html#L339" kind="function" beg="339" end="339">overflow</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags.overflow" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L339">#</a></dt>
<dd class="ddef">
<div class="summary">An infinity was generated by overflow (example: x = real.max*2;)</div></dd>
<dt class="decl">int <a class="symbol _function" name="IeeeFlags.divByZero" href="./htmlsrc/tango.math.IEEE.html#L341" kind="function" beg="341" end="341">divByZero</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags.divByZero" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L341">#</a></dt>
<dd class="ddef">
<div class="summary">An infinity was generated by division by zero (example: x = 3/0.0; )</div></dd>
<dt class="decl">int <a class="symbol _function" name="IeeeFlags.invalid" href="./htmlsrc/tango.math.IEEE.html#L343" kind="function" beg="343" end="343">invalid</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#IeeeFlags.invalid" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L343">#</a></dt>
<dd class="ddef">
<div class="summary">A machine NaN was generated. (example: x = real.infinity * 0.0; )</div></dd></dl></dd>
<dt class="decl">IeeeFlags <a class="symbol _function" name="ieeeFlags" href="./htmlsrc/tango.math.IEEE.html#L347" kind="function" beg="347" end="347">ieeeFlags</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#ieeeFlags" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L347">#</a></dt>
<dd class="ddef">
<div class="summary">Return a snapshot of the current state of the floating-point status flags.</div></dd>
<dt class="decl">void <a class="symbol _function" name="resetIeeeFlags" href="./htmlsrc/tango.math.IEEE.html#L350" kind="function" beg="350" end="350">resetIeeeFlags</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#resetIeeeFlags" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L350">#</a></dt>
<dd class="ddef">
<div class="summary">Set all of the floating-point status flags to false.</div></dd>
<dt class="decl">enum <a class="symbol _enum" name="RoundingMode" href="./htmlsrc/tango.math.IEEE.html#L355" kind="enum" beg="355" end="360">RoundingMode</a>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#RoundingMode" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L355">#</a></dt>
<dd class="ddef">
<div class="summary">IEEE rounding modes.
 The default mode is ROUNDTONEAREST.</div>
</dd>
<dt class="decl">RoundingMode <a class="symbol _function" name="setIeeeRounding" href="./htmlsrc/tango.math.IEEE.html#L373" kind="function" beg="373" end="390">setIeeeRounding</a><span class="params">(RoundingMode <em>roundingmode</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#setIeeeRounding" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L373">#</a></dt>
<dd class="ddef">
<div class="summary">Change the rounding mode used for all floating-point operations.</div>
Returns the old rounding mode.
<p class="bl"/>
 When changing the rounding mode, it is almost always necessary to restore it
 at the end of the function. Typical usage:
<pre class="d_code">
<span class="k">auto</span> <span class="i">oldrounding</span> = <span class="i">setIeeeRounding</span>(<span class="i">RoundingMode</span>.<span class="i">ROUNDDOWN</span>);
<span class="k">scope</span> (<span class="i">exit</span>) <span class="i">setIeeeRounding</span>(<span class="i">oldrounding</span>);
</pre></dd>
<dt class="decl">RoundingMode <a class="symbol _function" name="getIeeeRounding" href="./htmlsrc/tango.math.IEEE.html#L395" kind="function" beg="395" end="407">getIeeeRounding</a><span class="params">()</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#getIeeeRounding" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L395">#</a></dt>
<dd class="ddef">
<div class="summary">Get the IEEE rounding mode which is in use.</div></dd>
<dt class="decl">PrecisionControl <a class="symbol _function" name="reduceRealPrecision" href="./htmlsrc/tango.math.IEEE.html#L447" kind="function" beg="447" end="463">reduceRealPrecision</a><span class="params">(PrecisionControl <em>prec</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#reduceRealPrecision" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L447">#</a></dt>
<dd class="ddef">
<div class="summary">Set the number of bits of precision used by 'real'.</div>
<p class="sec_header">Returns:</p>the old precision.
 This is not supported on all platforms.</dd>
<dt class="decl">real <a class="symbol _function" name="frexp" href="./htmlsrc/tango.math.IEEE.html#L482" kind="function" beg="482" end="578">frexp</a><span class="params">(real <em>value</em>, out int <em>exp</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#frexp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L482">#</a></dt>
<dd class="ddef">
<div class="summary">Separate floating point value into significand and exponent.</div>
<p class="sec_header">Returns:</p>Calculate and return <i>x</i> and exp such that
  value =<i>x</i>*2<sup>exp</sup> and
  .5 &lt;= |<i>x</i>| &lt; 1.0<br>
  <i>x</i> has same sign as value.
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> value          <th> returns        <th> exp
  <tr> <td> &plusmn;0.0    <td> &plusmn;0.0    <td> 0
  <tr> <td> +&infin;       <td> +&infin;       <td> int.max
  <tr> <td> -&infin;       <td> -&infin;       <td> int.min
  <tr> <td> &plusmn;<span class="red">NAN</span> <td> &plusmn;<span class="red">NAN</span> <td> int.min
  </table></dd>
<dt class="decl">real <a class="symbol _function" name="ldexp" href="./htmlsrc/tango.math.IEEE.html#L637" kind="function" beg="637" end="652">ldexp</a><span class="params">(real <em>n</em>, int <em>exp</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#ldexp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L637">#</a></dt>
<dd class="ddef">
<div class="summary">Compute n * 2<sup>exp</sup></div>
<p class="sec_header">References:</p>frexp</dd>
<dt class="decl">int <a class="symbol _function" name="ilogb" href="./htmlsrc/tango.math.IEEE.html#L672" kind="function" beg="672" end="710">ilogb</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#ilogb" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L672">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the exponent of x as a signed integral value.</div>
If x is not a special value, the result is the same as
 <tt>cast(int)logb(x)</tt>.
<p class="sec_header">Remarks:</p>This function is consistent with IEEE754R, but it
 differs from the C function of the same name
 in the return value of infinity. (in C, ilogb(real.infinity)== int.max).
 Note that the special return values may all be equal.
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th>ilogb(x)           <th>invalid?
  <tr> <td> 0               <td> FP_ILOGB0         <th> yes
  <tr> <td> &plusmn;&infin; <td> FP_ILOGBINFINITY  <th> yes
  <tr> <td> <span class="red">NAN</span>          <td> FP_ILOGBNAN       <th> yes
  </table></dd>
<dt class="decl">real <a class="symbol _function" name="logb" href="./htmlsrc/tango.math.IEEE.html#L754" kind="function" beg="754" end="766">logb</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#logb" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L754">#</a></dt>
<dd class="ddef">
<div class="summary">Extracts the exponent of x as a signed integral value.</div>
If x is subnormal, it is treated as if it were normalized.
 For a positive, finite x:
<p class="bl"/>
 <pre class="d_code">
<span class="n">1</span> &lt;= $(<span class="i">I</span> <span class="i">x</span>) * <span class="i">FLT_RADIX</span>$(<span class="i">SUP</span> -<span class="i">logb</span>(<span class="i">x</span>)) &lt; <span class="i">FLT_RADIX</span>
</pre>
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th> logb(x)  <th> Divide by 0?
  <tr> <td> &plusmn;&infin; <td> +&infin; <td> no
  <tr> <td> &plusmn;0.0     <td> -&infin; <td> yes
  </table></dd>
<dt class="decl">real <a class="symbol _function" name="scalbn" href="./htmlsrc/tango.math.IEEE.html#L791" kind="function" beg="791" end="805">scalbn</a><span class="params">(real <em>x</em>, int <em>n</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#scalbn" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L791">#</a></dt>
<dd class="ddef">
<div class="summary">Efficiently calculates x * 2<sup>n</sup>.</div>
scalbn handles underflow and overflow in
 the same fashion as the basic arithmetic operators.
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x                <th> scalb(x)
  <tr> <td> &plusmn;&infin; <td> &plusmn;&infin;
  <tr> <td> &plusmn;0.0      <td> &plusmn;0.0
  </table></dd>
<dt class="decl">real <a class="symbol _function" name="fdim" href="./htmlsrc/tango.math.IEEE.html#L825" kind="function" beg="825" end="828">fdim</a><span class="params">(real <em>x</em>, real <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#fdim" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L825">#</a></dt>
<dd class="ddef">
<div class="summary">Returns the positive difference between x and y.</div>
If either of x or y is <span class="red">NAN</span>, it will be returned.
<p class="sec_header">Returns:</p><table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr><th>Arguments</th> <th>fdim(x, y)</th></tr>
  <tr><td>x &gt; y</td> <td>x - y</td></tr>
  <tr><td>x &lt;= y</td> <td>+0.0</td></tr>
 </table></dd>
<dt class="decl">real <a class="symbol _function" name="fabs" href="./htmlsrc/tango.math.IEEE.html#L845" kind="function" beg="845" end="858">fabs</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#fabs" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L845">#</a></dt>
<dd class="ddef">
<div class="summary">Returns |x|</div>
<table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th> fabs(x)
  <tr> <td> &plusmn;0.0     <td> +0.0
  <tr> <td> &plusmn;&infin; <td> +&infin;
  </table></dd>
<dt class="decl">real <a class="symbol _function" name="fma" href="./htmlsrc/tango.math.IEEE.html#L870" kind="function" beg="870" end="873">fma</a><span class="params">(float <em>x</em>, float <em>y</em>, float <em>z</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#fma" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L870">#</a></dt>
<dd class="ddef">
<div class="summary">Returns (x * y) + z, rounding only once according to the
 current rounding mode.</div>
<p class="sec_header"><span class="red">Bugs:</span></p>Not currently implemented - rounds twice.</dd>
<dt class="decl">creal <a class="symbol _function" name="expi" href="./htmlsrc/tango.math.IEEE.html#L882" kind="function" beg="882" end="896">expi</a><span class="params">(real <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#expi" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L882">#</a></dt>
<dd class="ddef">
<div class="summary">Calculate cos(y) + i sin(y).</div>
On x86 CPUs, this is a very efficient operation;
 almost twice as fast as calculating sin(y) and cos(y)
 seperately, and is the preferred method when both are required.</dd>
<dt class="decl">int <a class="symbol _function" name="isNaN" href="./htmlsrc/tango.math.IEEE.html#L910" kind="function" beg="910" end="930">isNaN</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isNaN" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L910">#</a></dt>
<dd class="ddef">
<div class="summary">Returns !=0 if e is a NaN.</div></dd>
<dt class="decl">int <a class="symbol _function" name="isNormal" href="./htmlsrc/tango.math.IEEE.html#L951" kind="function" beg="951" end="963">isNormal</a><span class="tparams">(X)</span><span class="params">(X <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isNormal" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L951">#</a></dt>
<dd class="ddef">
<div class="summary">Returns !=0 if x is normalized.</div>
(Need one for each format because subnormal
  floats might be converted to normal reals)</dd>
<dt class="decl">bool <a class="symbol _function" name="isIdentical" href="./htmlsrc/tango.math.IEEE.html#L993" kind="function" beg="993" end="1008">isIdentical</a><span class="params">(real <em>x</em>, real <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isIdentical" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L993">#</a></dt>
<dt class="decl">bool <a class="symbol _function" name="isIdentical:2" href="./htmlsrc/tango.math.IEEE.html#L1011" kind="function" beg="1011" end="1013">isIdentical</a><span class="params">(ireal <em>x</em>, ireal <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isIdentical:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1011">#</a></dt>
<dt class="decl">bool <a class="symbol _function" name="isIdentical:3" href="./htmlsrc/tango.math.IEEE.html#L1016" kind="function" beg="1016" end="1018">isIdentical</a><span class="params">(creal <em>x</em>, creal <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isIdentical:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1016">#</a></dt>
<dd class="ddef">
<div class="summary">Is the binary representation of x identical to y?</div>
Same as ==, except that positive and negative zero are not identical,
 and two <span class="red">NAN</span>s are identical if they have the same 'payload'.</dd>
<dt class="decl">int <a class="symbol _function" name="isSubnormal" href="./htmlsrc/tango.math.IEEE.html#L1044" kind="function" beg="1044" end="1048">isSubnormal</a><span class="params">(float <em>f</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isSubnormal" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1044">#</a></dt>
<dt class="decl">int <a class="symbol _function" name="isSubnormal:2" href="./htmlsrc/tango.math.IEEE.html#L1062" kind="function" beg="1062" end="1066">isSubnormal</a><span class="params">(double <em>d</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isSubnormal:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1062">#</a></dt>
<dt class="decl">int <a class="symbol _function" name="isSubnormal:3" href="./htmlsrc/tango.math.IEEE.html#L1080" kind="function" beg="1080" end="1097">isSubnormal</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isSubnormal:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1080">#</a></dt>
<dd class="ddef">
<div class="summary">Is number subnormal? (Also called "denormal".)
 Subnormals have a 0 exponent and a 0 most significant significand bit,
 but are non-zero.</div></dd>
<dt class="decl">int <a class="symbol _function" name="isZero" href="./htmlsrc/tango.math.IEEE.html#L1114" kind="function" beg="1114" end="1127">isZero</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isZero" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1114">#</a></dt>
<dd class="ddef">
<div class="summary">Return !=0 if x is &plusmn;0.</div>
Does not affect any floating-point flags</dd>
<dt class="decl">int <a class="symbol _function" name="isInfinity" href="./htmlsrc/tango.math.IEEE.html#L1143" kind="function" beg="1143" end="1160">isInfinity</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#isInfinity" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1143">#</a></dt>
<dd class="ddef">
<div class="summary">Return !=0 if e is &plusmn;&infin;.</div></dd>
<dt class="decl">real <a class="symbol _function" name="nextUp" href="./htmlsrc/tango.math.IEEE.html#L1193" kind="function" beg="1193" end="1260">nextUp</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextUp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1193">#</a></dt>
<dt class="decl">double <a class="symbol _function" name="nextDoubleUp" href="./htmlsrc/tango.math.IEEE.html#L1263" kind="function" beg="1263" end="1282">nextDoubleUp</a><span class="params">(double <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextDoubleUp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1263">#</a></dt>
<dt class="decl">float <a class="symbol _function" name="nextFloatUp" href="./htmlsrc/tango.math.IEEE.html#L1285" kind="function" beg="1285" end="1304">nextFloatUp</a><span class="params">(float <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextFloatUp" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1285">#</a></dt>
<dd class="ddef">
<div class="summary">Calculate the next largest floating point value after x.</div>
Return the least number greater than x that is representable as a real;
 thus, it gives the next point on the IEEE number line.
 This function is included in the forthcoming IEEE 754R standard.
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
    <tr><th>x</th> <th>nextup(x)   </th></tr>
    <tr><td>-&infin;</td> <td>-real.max   </td></tr>
    <tr><td>&plusmn;0.0</td> <td>real.min*real.epsilon </td></tr>
    <tr><td>real.max</td> <td>real.infinity </td></tr>
    <tr><td>real.infinity</td> <td>real.infinity </td></tr>
    <tr><td><span class="red">NAN</span></td> <td><span class="red">NAN</span>        </td></tr>
 </table>
<p class="bl"/>
 nextDoubleUp and nextFloatUp are the corresponding functions for
 the IEEE double and IEEE float number lines.</dd>
<dt class="decl">X <a class="symbol _function" name="splitSignificand" href="./htmlsrc/tango.math.IEEE.html#L1370" kind="function" beg="1370" end="1393">splitSignificand</a><span class="tparams">(X)</span><span class="params">(inout X <em>x</em>)</span>; <span class="attrs">[<span class="prot">package</span>]</span> <a title="Permalink to this symbol" href="#splitSignificand" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1370">#</a></dt>
<dd class="ddef">
<div class="summary">Reduces the magnitude of x, so the bits in the lower half of its significand
 are all zero. Returns the amount which needs to be added to x to restore its
 initial value; this amount will also have zeros in all bits in the lower half
 of its significand.</div></dd>
<dt class="decl">real <a class="symbol _function" name="nextDown" href="./htmlsrc/tango.math.IEEE.html#L1423" kind="function" beg="1423" end="1426">nextDown</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextDown" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1423">#</a></dt>
<dt class="decl">double <a class="symbol _function" name="nextDoubleDown" href="./htmlsrc/tango.math.IEEE.html#L1429" kind="function" beg="1429" end="1432">nextDoubleDown</a><span class="params">(double <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextDoubleDown" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1429">#</a></dt>
<dt class="decl">float <a class="symbol _function" name="nextFloatDown" href="./htmlsrc/tango.math.IEEE.html#L1435" kind="function" beg="1435" end="1438">nextFloatDown</a><span class="params">(float <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextFloatDown" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1435">#</a></dt>
<dd class="ddef">
<div class="summary">Calculate the next smallest floating point value before x.</div>
Return the greatest number less than x that is representable as a real;
 thus, it gives the previous point on the IEEE number line.
<p class="sec_header">Note:</p>This function is included in the forthcoming IEEE 754R standard.
<p class="bl"/>
 Special values:
 real.infinity   real.max
 real.min*real.epsilon 0.0
 0.0             -real.min*real.epsilon
 -0.0            -real.min*real.epsilon
 -real.max        -real.infinity
 -real.infinity    -real.infinity
 NAN              NAN
<p class="bl"/>
 nextDoubleDown and nextFloatDown are the corresponding functions for
 the IEEE double and IEEE float number lines.</dd>
<dt class="decl">real <a class="symbol _function" name="nextafter" href="./htmlsrc/tango.math.IEEE.html#L1463" kind="function" beg="1463" end="1467">nextafter</a><span class="params">(real <em>x</em>, real <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#nextafter" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1463">#</a></dt>
<dd class="ddef">
<div class="summary">Calculates the next representable value after x in the direction of y.</div>
If y &gt; x, the result will be the next largest floating-point value;
 if y &lt; x, the result will be the next smallest value.
 If x == y, the result is y.
<p class="sec_header">Remarks:</p>This function is not generally very useful; it's almost always better to use
 the faster functions nextUp() or nextDown() instead.
<p class="bl"/>
 IEEE 754 requirements not implemented:
 The FE_INEXACT and FE_OVERFLOW exceptions will be raised if x is finite and
 the function result is infinite. The FE_INEXACT and FE_UNDERFLOW
 exceptions will be raised if the function value is subnormal, and x is
 not equal to y.</dd>
<dt class="decl">int <a class="symbol _function" name="feqrel" href="./htmlsrc/tango.math.IEEE.html#L1487" kind="function" beg="1487" end="1548">feqrel</a><span class="tparams">(X)</span><span class="params">(X <em>x</em>, X <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#feqrel" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1487">#</a></dt>
<dd class="ddef">
<div class="summary">To what precision is x equal to y?</div>
<p class="sec_header">Returns:</p>the number of significand bits which are equal in x and y.
 eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.
<p class="bl"/>
  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
    <tr><th>x</th> <th>y</th> <th>feqrel(x, y)  </th></tr>
    <tr><td>x</td> <td>x</td> <td>real.mant_dig </td></tr>
    <tr><td>x</td> <td>&gt;= 2*x</td> <td>0 </td></tr>
    <tr><td>x</td> <td>&lt;= x/2</td> <td>0 </td></tr>
    <tr><td><span class="red">NAN</span></td> <td>any</td> <td>0 </td></tr>
    <tr><td>any</td> <td><span class="red">NAN</span></td> <td>0 </td></tr>
  </table>
<p class="sec_header">Remarks:</p>This is a very fast operation, suitable for use in speed-critical code.</dd>
<dt class="decl">int <a class="symbol _function" name="signbit" href="./htmlsrc/tango.math.IEEE.html#L1600" kind="function" beg="1600" end="1603">signbit</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#signbit" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1600">#</a></dt>
<dd class="ddef">
<div class="summary">Return 1 if sign bit of e is set, 0 if not.</div></dd>
<dt class="decl">real <a class="symbol _function" name="copysign" href="./htmlsrc/tango.math.IEEE.html#L1622" kind="function" beg="1622" end="1631">copysign</a><span class="params">(real <em>to</em>, real <em>from</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#copysign" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1622">#</a></dt>
<dd class="ddef">
<div class="summary">Return a value composed of to with from's sign bit.</div></dd>
<dt class="decl">T <a class="symbol _function" name="ieeeMean" href="./htmlsrc/tango.math.IEEE.html#L1670" kind="function" beg="1670" end="1748">ieeeMean</a><span class="tparams">(T)</span><span class="params">(T <em>x</em>, T <em>y</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#ieeeMean" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1670">#</a></dt>
<dd class="ddef">
<div class="summary">Return the value that lies halfway between x and y on the IEEE number line.</div>
Formally, the result is the arithmetic mean of the binary significands of x
 and y, multiplied by the geometric mean of the binary exponents of x and y.
 x and y must have the same sign, and must not be NaN.
<p class="sec_header">Note:</p>this function is useful for ensuring O(log n) behaviour in algorithms
 involving a 'binary chop'.
<p class="bl"/>
 Special cases:
 If x and y are within a factor of 2, (ie, feqrel(x, y) &gt; 0), the return value
 is the arithmetic mean (x + y) / 2.
 If x and y are even powers of 2, the return value is the geometric mean,
   ieeeMean(x, y) = sqrt(x * y).</dd>
<dt class="decl">real <a class="symbol _function" name="NaN" href="./htmlsrc/tango.math.IEEE.html#L1785" kind="function" beg="1785" end="1833">NaN</a><span class="params">(ulong <em>payload</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#NaN" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1785">#</a></dt>
<dd class="ddef">
<div class="summary">Create a <span class="red">NAN</span>, storing an integer inside the payload.</div>
For 80-bit or 128-bit reals, the largest possible payload is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.</dd>
<dt class="decl">ulong <a class="symbol _function" name="getNaNPayload" href="./htmlsrc/tango.math.IEEE.html#L1845" kind="function" beg="1845" end="1870">getNaNPayload</a><span class="params">(real <em>x</em>)</span>; <span class="attrs">[<span class="prot">public</span>]</span> <a title="Permalink to this symbol" href="#getNaNPayload" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/tango.math.IEEE.html#L1845">#</a></dt>
<dd class="ddef">
<div class="summary">Extract an integral payload from a <span class="red">NAN</span>.</div>
<p class="sec_header">Returns:</p>the integer payload as a ulong.
<p class="bl"/>
 For 80-bit or 128-bit reals, the largest possible payload is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.</dd></dl>
</div>
<div id="footer">
  <p>Portions Copyright (C) 2001-2005 Digital Mars.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Fri Dec 26 04:04:14 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>